<div class="articles view">
    <h2 class="left"><?php __('Artículo'); ?></h2>
    <div class="actions specific">
        <ul>
            <li><?php echo $this->Html->link(__('Pedir', true), array('controller' => 'orders','action' => 'add', $article['Article']['id'])); ?> </li>
            <li><?php echo $this->Html->link(__('Cambiar Imágen', true), array('action' => 'imagen', $article['Article']['id'])); ?> </li>
            <li><?php echo $this->Html->link(__('Editar', true), array('action' => 'edit', $article['Article']['id'])); ?> </li>
            <li><?php
            if($article['Article']['termination_date'] == NULL){
                echo $this->Html->link(__('Dar Baja', true), array('action' => 'baja', $article['Article']['id']), null, sprintf(__('Esta seguro que desea dar baja a # %s?', true), $article['Article']['mark'] . '-' . $article['Article']['model'])); 
            }else{
                echo $this->Html->link(__('Deshacer Baja', true), array('action' => 'deshacer_baja', $article['Article']['id']));
            }
            ?> </li>
            <li><?php echo $this->Html->link(__('Eliminar', true), array('action' => 'delete', $article['Article']['id']), null, sprintf(__('Esta seguro que desea eliminar el artículo # %s?', true), $article['Article']['mark'] . '-' . $article['Article']['model'])); ?> </li>
        </ul>
    </div>
    <br />
    <br />
    <br />
    <dl><?php $i = 0;
$class = ' class="altrow"'; ?>
        <dt<?php if ($i % 2 == 0)
            echo $class; ?>><?php __('Id'); ?></dt>
        <dd<?php if ($i++ % 2 == 0)
                echo $class; ?>>
                <?php echo $article['Article']['id']; ?>
            &nbsp;
        </dd>
        <dt<?php if ($i % 2 == 0)
                    echo $class; ?>><?php __('Marca'); ?></dt>
        <dd<?php if ($i++ % 2 == 0)
                echo $class; ?>>
                <?php echo $article['Article']['mark']; ?>
            &nbsp;
        </dd>
        <dt<?php if ($i % 2 == 0)
                    echo $class; ?>><?php __('Modelo'); ?></dt>
        <dd<?php if ($i++ % 2 == 0)
                echo $class; ?>>
                <?php echo $article['Article']['model']; ?>
            &nbsp;
        </dd>
        <dt<?php if ($i % 2 == 0)
                    echo $class; ?>><?php __('Código'); ?></dt>
        <dd<?php if ($i++ % 2 == 0)
                echo $class; ?>>
                <?php echo $article['Article']['code']; ?>
            &nbsp;
        </dd>
        <dt<?php if ($i % 2 == 0)
                    echo $class; ?>><?php __('Estilo'); ?></dt>
        <dd<?php if ($i++ % 2 == 0)
                echo $class; ?>>
                <?php echo $article['Article']['style']; ?>
            &nbsp;
        </dd>
        <dt<?php if ($i % 2 == 0)
                    echo $class; ?>><?php __('Material'); ?></dt>
        <dd<?php if ($i++ % 2 == 0)
                echo $class; ?>>
                <?php echo $article['Article']['material']; ?>
            &nbsp;
        </dd>
        <dt<?php if ($i % 2 == 0)
                    echo $class; ?>><?php __('Cabezal'); ?></dt>
        <dd<?php if ($i++ % 2 == 0)
                echo $class; ?>>
                <?php echo $article['Article']['head']; ?>
            &nbsp;
        </dd>
        <dt<?php if ($i % 2 == 0)
                    echo $class; ?>><?php __('Detalle'); ?></dt>
        <dd<?php if ($i++ % 2 == 0)
                echo $class; ?>>
                <?php echo $article['Article']['detail']; ?>
            &nbsp;
        </dd>
        <dt<?php if ($i % 2 == 0)
                    echo $class; ?>><?php __('Precio'); ?></dt>
        <dd<?php if ($i++ % 2 == 0)
                echo $class; ?>>
                <?php echo '$'.$article['Article']['price']; ?>
            &nbsp;
        </dd>
        <dt<?php if ($i % 2 == 0)
                    echo $class; ?>><?php __('Stock'); ?></dt>
        <dd<?php if ($i++ % 2 == 0)
                echo $class; ?>>
                <?php echo $article['Article']['amount_available']; ?>
            &nbsp;
        </dd>
        <dt<?php if ($i % 2 == 0)
                    echo $class; ?>><?php __('Min Stock'); ?></dt>
        <dd<?php if ($i++ % 2 == 0)
                echo $class; ?>>
                <?php echo $article['Article']['min']; ?>
            &nbsp;
        </dd>
        <dt<?php if ($i % 2 == 0)
                    echo $class; ?>><?php __('Fecha de Baja'); ?></dt>
        <dd<?php if ($i++ % 2 == 0)
                echo $class; ?>>
                <?php
                if ($article['Article']['termination_date'] != NULL) {
                    $fecha = date('d/m/Y', strtotime($article['Article']['termination_date']));
                    echo $fecha;
                }
                ?>
            &nbsp;
        </dd>
        <dt<?php if ($i % 2 == 0)
                    echo $class; ?>><?php __('Tipo'); ?></dt>
        <dd<?php if ($i++ % 2 == 0)
                echo $class; ?>>
                <?php echo $this->Html->link($article['Type']['name'], array('controller' => 'types', 'action' => 'view', $article['Type']['id'])); ?>
            &nbsp;
        </dd>
        <dt<?php if ($i % 2 == 0)
                    echo $class; ?>><?php __('Imagen'); ?></dt>
        <dd<?php if ($i++ % 2 == 0)
                echo $class; ?>>
                <?php echo $html->image('articulos/' . $article['Article']['id'] . '/' . $article['Article']['image'], array('width' => '140px', 'height' => '140px')); ?>
            &nbsp;
        </dd>
    </dl>
</div>
<!--<div class="related">
        <h3><?php __('Related Items'); ?></h3>
<?php if (!empty($article['Item'])): ?>
                            <table cellpadding = "0" cellspacing = "0">
                            <tr>
                                    <th><?php __('Id'); ?></th>
                                    <th><?php __('Sale Amount'); ?></th>
                                    <th><?php __('Temp Price'); ?></th>
                                    <th><?php __('Article Id'); ?></th>
                                    <th><?php __('Sale Id'); ?></th>
                                    <th class="actions"><?php __('Actions'); ?></th>
                            </tr>
    <?php
    $i = 0;
    foreach ($article['Item'] as $item):
        $class = null;
        if ($i++ % 2 == 0) {
            $class = ' class="altrow"';
        }
        ?>
                                                        <tr<?php echo $class; ?>>
                                                                <td><?php echo $item['id']; ?></td>
                                                                <td><?php echo $item['sale_amount']; ?></td>
                                                                <td><?php echo $item['temp_price']; ?></td>
                                                                <td><?php echo $item['article_id']; ?></td>
                                                                <td><?php echo $item['sale_id']; ?></td>
                                                                <td class="actions">
        <?php echo $this->Html->link(__('View', true), array('controller' => 'items', 'action' => 'view', $item['id'])); ?>
        <?php echo $this->Html->link(__('Edit', true), array('controller' => 'items', 'action' => 'edit', $item['id'])); ?>
        <?php echo $this->Html->link(__('Delete', true), array('controller' => 'items', 'action' => 'delete', $item['id']), null, sprintf(__('Are you sure you want to delete # %s?', true), $item['id'])); ?>
                                                                </td>
                                                        </tr>
    <?php endforeach; ?>
                            </table>
<?php endif; ?>

        <div class="actions">
                <ul>
                        <li><?php echo $this->Html->link(__('New Item', true), array('controller' => 'items', 'action' => 'add')); ?> </li>
                </ul>
        </div>
</div>-->
<!--<div class="related">
        <h3><?php __('Related Purchases'); ?></h3>
<?php if (!empty($article['Purchase'])): ?>
                            <table cellpadding = "0" cellspacing = "0">
                            <tr>
                                    <th><?php __('Id'); ?></th>
                                    <th><?php __('Purchase Date'); ?></th>
                                    <th><?php __('Purchase Amount'); ?></th>
                                    <th><?php __('Article Id'); ?></th>
                                    <th class="actions"><?php __('Actions'); ?></th>
                            </tr>
    <?php
    $i = 0;
    foreach ($article['Purchase'] as $purchase):
        $class = null;
        if ($i++ % 2 == 0) {
            $class = ' class="altrow"';
        }
        ?>
                                                        <tr<?php echo $class; ?>>
                                                                <td><?php echo $purchase['id']; ?></td>
                                                                <td><?php echo $purchase['purchase_date']; ?></td>
                                                                <td><?php echo $purchase['purchase_amount']; ?></td>
                                                                <td><?php echo $purchase['article_id']; ?></td>
                                                                <td class="actions">
        <?php echo $this->Html->link(__('View', true), array('controller' => 'purchases', 'action' => 'view', $purchase['id'])); ?>
        <?php echo $this->Html->link(__('Edit', true), array('controller' => 'purchases', 'action' => 'edit', $purchase['id'])); ?>
        <?php echo $this->Html->link(__('Delete', true), array('controller' => 'purchases', 'action' => 'delete', $purchase['id']), null, sprintf(__('Are you sure you want to delete # %s?', true), $purchase['id'])); ?>
                                                                </td>
                                                        </tr>
    <?php endforeach; ?>
                            </table>
<?php endif; ?>

        <div class="actions">
                <ul>
                        <li><?php echo $this->Html->link(__('New Purchase', true), array('controller' => 'purchases', 'action' => 'add')); ?> </li>
                </ul>
        </div>
</div>-->
